package blog.service.impl.back;

import blog.dao.back.DocumentBackMapper;
import blog.entity.Document;
import blog.service.back.DocumentBackService;
import blog.vo.back.*;
import blog.vo.common.PaginationVO;
import cn.hutool.core.bean.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 　　* @description: TODO
 * 　　* @param
 * 　　* @return
 * 　　* @throws
 * 　　* @author Administrator
 * 　　* @date $ $
 *
 */
@Service
public class DocumentBackServiceImpl implements DocumentBackService {
    @Autowired
    private DocumentBackMapper documentBackMapper;

    @Override
    public List<DocumentVO> getAllDocument(PaginationVO paginationVO) {
        return documentBackMapper.getAllDocument(paginationVO.getPageNum(),paginationVO.getPageSize());
    }

    @Override
    public List<DocumentVO> byDocumentStatusGetAllDocument(ByDocumentStatusGetAllDocumentVO byDocumentStatusGetAllDocumentVO) {
        return documentBackMapper.byDocumentStatusGetAllDocument(byDocumentStatusGetAllDocumentVO);
    }

    @Override
    public int updateDocumentStatus(UpdateDocumentStatusVO updateDocumentStatusVO) {
        Document document = BeanUtil.copyProperties(updateDocumentStatusVO, Document.class);
        return documentBackMapper.updateDocumentStatus(document);
    }

    @Override
    public int addDocument(AddDocumentVO addDocumentVO) {
        Document document = BeanUtil.copyProperties(addDocumentVO, Document.class);
        return documentBackMapper.addDocument(document);
    }
}
